
/**
 * this总是指向词法作用域，也就是外层调用者
 */

// const arr = [1, 2, 3, 4, 5, 6];

// let r = arr.filter((item) => item % 2);
// console.log(r);

const person = {
  name: "tom",
  //   sayHi: function () {
  //     console.log(this.name);  //tom
  //   },
  sayHi: () => {
    console.log(this.name); //undefined
  },
  sayHiAsync: function () {
    setTimeout(() => {
      console.log(this.name); //tom
    }, 1000);
  },
};
person.sayHi();
person.sayHiAsync();
